import request from '@/router/axios';
//FMEA
//FMEA列表
export const getFMEAList = (params) => {
  return request({
    url: '/api/hg-public/fmeaplandetail/page',
    method: 'get',
    params: {
      ...params
    }
  })
}
//新增/更新FMEA
export const addFMEA = (row) => {
  return request({
    url: '/api/hg-public/fmeaplan/submit',
    method: 'post',
    data: row
  })
}

//删除FMEA-解除与产品计划的关系
export const removeFMEA = (ids) => {
  return request({
    url: '/api/hg-public/fmeaplan/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

//获取FMEA
export const getFMEA = (prodPlanListId, fmeaPlanId) => {
  return request({
    url: '/api/hg-public/fmeaplan/getFmeaPlanDetail',
    method: 'get',
    params: {
      prodPlanListId, fmeaPlanId
    }
  })
}

// 提交FMEA 
export const submitFmea = (fmeaPlanId) => {
  return request({
    url: '/api/hg-public/fmeaplan/start-process',
    method: 'get',
    params: {
      fmeaPlanId
    }
  })
}

//MSA
//MSA列表
export const getMSAList = (params) => {
  return request({
    url: '/api/hg-public/msaplandetail/page',
    method: 'get',
    params: {
      ...params
    }
  })
}
//新增/更新MSA
export const addMSA = (row) => {
  return request({
    url: '/api/hg-public/msaplan/submit',
    method: 'post',
    data: row
  })
}

//删除MSA-解除与产品计划的关系
export const removeMSA = (ids) => {
  return request({
    url: '/api/hg-public/msaplan/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

//获取MSA
export const getMSA = (prodPlanListId, msaPlanId) => {
  return request({
    url: '/api/hg-public/msaplan/getMsaPlanDetail',
    method: 'get',
    params: {
      prodPlanListId, msaPlanId
    }
  })
}

//提交MSA
export const submitMSA = (msaPlanId) => {
  return request({
    url: '/api/hg-public/msaplan/start-process',
    method: 'get',
    params: {
      msaPlanId
    }
  })
}

//初始过程能力计划
//初始过程能力计划列表
export const getAbilityList = (params) => {
  return request({
    url: '/api/hg-public/initcpkplandetail/page',
    method: 'get',
    params: {
      ...params
    }
  })
}
//新增/更新初始过程能力计划
export const addAbility = (row) => {
  return request({
    url: '/api/hg-public/initcpkplan/submit',
    method: 'post',
    data: row
  })
}

//删除初始过程能力计划-解除与产品计划的关系
export const removeAbility = (ids) => {
  return request({
    url: '/api/hg-public/initcpkplan/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

//获取初始过程能力计划
export const getAbility = (prodPlanListId, cpkPlanId) => {
  return request({
    url: '/api/hg-public/initcpkplan/getCpkPlanDetail',
    method: 'get',
    params: {
      prodPlanListId, cpkPlanId
    }
  })
}

// 提交初始过程能力
export const submitAbility = (initCpkPlanId) => {
  return request({
    url: '/api/hg-public/initcpkplan/start-process',
    method: 'get',
    params: {
      initCpkPlanId
    }
  })
}


//控制计划
//控制计划列表
export const getControlList = (params) => {
  return request({
    url: '/api/hg-public/controlplandetail/page',
    method: 'get',
    params: {
      ...params
    }
  })
}
//新增/更新控制计划
export const addControl = (row) => {
  return request({
    url: '/api/hg-public/controlplan/submit',
    method: 'post',
    data: row
  })
}

//删除控制计划-解除与产品计划的关系
export const removeControl = (ids) => {
  return request({
    url: '/api/hg-public/controlplan/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}
//根据FMEA单号 获取FMEA结果（严重程度）
export const getControlFMEAresult = (fmeaPlanId) => {
  return request({
    url: '/api/hg-public/controlplan/getFmeaPlanDegrees',
    method: 'get',
    params: {
      fmeaPlanId
    }
  })
}
//获取控制计划
export const getControl = (prodPlanListId, controlPlanId) => {
  return request({
    url: '/api/hg-public/controlplan/getConPlanDetail',
    method: 'get',
    params: {
      prodPlanListId, controlPlanId
    }
  })
}

//提交控制计划
export const submitControl = (controlPlanId) => {
  return request({
    url: '/api/hg-public/controlplan/start-process',
    method: 'get',
    params: {
      controlPlanId
    }
  })
}

//模具制造计划
//模具制造计划列表
export const getMoldPlanList = (params) => {
  return request({
    url: '/api/hg-public/mouldplandetail/page',
    method: 'get',
    params: {
      ...params
    }
  })
}
//新增/更新模具制造计划
export const addMoldPlan = (row) => {
  return request({
    url: '/api/hg-public/mouldplan/submit',
    method: 'post',
    data: row
  })
}

//删除模具制造计划 
export const removeMoldPlan = (ids) => {
  return request({
    url: '/api/hg-public/mouldplan/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

//获取模具制造计划
export const getMoldPlan = (prodPlanListId, mouldPlanId) => {
  return request({
    url: '/api/hg-public/mouldplan/getMouldPlanDetail',
    method: 'get',
    params: {
      prodPlanListId, mouldPlanId
    }
  })
}


//检具制造计划
//检具制造计划列表
export const getFixturePlanList = (params) => {
  return request({
    url: '/api/hg-public/checktoolplandetail/page',
    method: 'get',
    params: {
      ...params
    }
  })
}
//新增/更新检具制造计划
export const addFixturePlan = (row) => {
  return request({
    url: '/api/hg-public/checktoolplan/submit',
    method: 'post',
    data: row
  })
}

//删除检具制造计划 
export const removeFixturePlan = (ids) => {
  return request({
    url: '/api/hg-public/checktoolplan/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

//更新检具制造计划
export const updateFixturePlan = (row) => {
  return request({
    url: '/api/hg-public/checktoolplan/update',
    method: 'post',
    data: row
  })
}

//获取检具制造计划
export const getFixturePlan = (prodPlanListId, checkToolPlanId) => {
  return request({
    url: '/api/hg-public/checktoolplan/getCheckToolPlanDetail',
    method: 'get',
    params: {
      prodPlanListId, checkToolPlanId
    }
  })
}


//工位器具制造计划
//工位器具制造计划列表
export const getWorkappPlanList = (params) => {
  return request({
    url: '/api/hg-public/workpostoolplandetail/page',
    method: 'get',
    params: {
      ...params
    }
  })
}
//新增/更新工位器具制造计划
export const addWorkappPlan = (row) => {
  return request({
    url: '/api/hg-public/workpostoolplan/submit',
    method: 'post',
    data: row
  })
}

//删除工位器具制造计划
export const removeWorkappPlan = (ids) => {
  return request({
    url: '/api/hg-public/workpostoolplan/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}


//获取工位器具制造计划
export const getWorkappPlan = (prodPlanListId, workPosToolPlanId) => {
  return request({
    url: '/api/hg-public/workpostoolplan/getWorkPosPlanDetail',
    method: 'get',
    params: {
      prodPlanListId, workPosToolPlanId
    }
  })
}


//OTS计划
//OTS计划列表
export const getOTSPlanList = (params) => {
  return request({
    url: '/api/hg-public/otsplan/page',
    method: 'get',
    params: {
      ...params
    }
  })
}
//新增/编辑OTS计划
export const addOTSPlan = (row) => {
  return request({
    url: '/api/hg-public/otsplan/submit',
    method: 'post',
    data: row
  })
}

//删除OTS计划
export const removeOTSPlan = (ids) => {
  return request({
    url: '/api/hg-public/otsplan/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

//获取OTS计划
export const getOTSPlan = (id) => {
  return request({
    url: '/api/hg-public/otsplan/detail',
    method: 'get',
    params: {
      id,
    }
  })
}


//TP计划
//TP计划列表
export const getTPPlanList = (params) => {
  return request({
    url: '/api/hg-public/tpplan/page',
    method: 'get',
    params: {
      ...params
    }
  })
}
//新增/编辑TP计划
export const addTPPlan = (row) => {
  return request({
    url: '/api/hg-public/tpplan/submit',
    method: 'post',
    data: row
  })
}

//删除TP计划
export const removeTPPlan = (ids) => {
  return request({
    url: '/api/hg-public/tpplan/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}


//获取TP计划
export const getTPPlan = (id) => {
  return request({
    url: '/api/hg-public/tpplan/detail',
    method: 'get',
    params: {
      id,
    }
  })
}



//爬坡计划
//爬坡计划列表
export const getClimbingList = (params) => {
  return request({
    url: '/api/hg-public/climbplan/page',
    method: 'get',
    params: {
      ...params
    }
  })
}
//新增/编辑爬坡计划
export const addClimbing = (row) => {
  return request({
    url: '/api/hg-public/climbplan/submit',
    method: 'post',
    data: row
  })
}

//删除爬坡计划
export const removeClimbing = (ids) => {
  return request({
    url: '/api/hg-public/climbplan/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}


//获取爬坡计划
export const getClimbing = (id) => {
  return request({
    url: '/api/hg-public/climbplan/detail',
    method: 'get',
    params: {
      id,
    }
  })
}


//PO计划
//PO计划列表
export const getPOList = (params) => {
  return request({
    url: '/api/hg-public/poproduceplan/page',
    method: 'get',
    params: {
      ...params
    }
  })
}
//新增/更新PO计划
export const addPO = (row) => {
  return request({
    url: '/api/hg-public/poproduceplan/submit',
    method: 'post',
    data: row
  })
}
// 更新PO计划
export const updatePO = (row) => {
  return request({
    url: '/api/hg-public/poproduceplan/submit',
    method: 'post',
    data: row
  })
}
//删除PO计划-解除与产品计划的关系
export const removePO = (ids) => {
  return request({
    url: '/api/hg-public/poproduceplan/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

//获取PO计划
export const getPO = (id) => {
  return request({
    url: '/api/hg-public/poproduceplan/detail',
    method: 'get',
    params: {
      id
    }
  })
}

// 获取po订单list
export const getPodetails = (params) => {
  return request({
    url: '/api/hg-public/poshipplan/getPoDetail',
    method: 'get',
    params: {
      ...params
    }
  })
}